<?php

namespace App\Containers\AppSection\Accreditation\Tasks;

use App\Containers\AppSection\Accreditation\Data\Repositories\RemarkRepository;
use App\Ship\Exceptions\BadRequestException;
use App\Ship\Parents\Tasks\Task;
use Exception;

class CreateRemarkTask extends Task
{

    protected RemarkRepository $repository;

    public function __construct(
        RemarkRepository $repository
    )
    {
        $this->repository = $repository;
    }

    public function run($data)
    {
        try {
            $this->repository->create($data);
        } catch (Exception $exception) {
            throw new BadRequestException($exception->getMessage());
        }
    }
}
